# encoding=utf-8

import sqlite3

con = sqlite3.connect('/Users/graceli/project/PythonTestProject/my02/数据表/demo.db')
cur = con.cursor()
sql = 'insert into t_person(pname,age) values(?,?)'
try:
    # cur.execute(sql,('grace',24))
    cur.executemany(sql,[('ljx',18),('ann',30),('john',29)])

    con.commit()
    print('插入多条数据成功')
except Exception as e:
    print(e)
    con.rollback()
    print('插入数据失败')
finally:
    cur.close()
    con.close()